home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-01-05 | 2.0 KB | 98 lines | [TEXT/CWIE] |
- /*
- * Utility assembly routines.
- *
- * Copyright 1992-1993 Merit Network, Inc. and The Regents of the
- * University of Michigan. Usage of this source code is restricted
- * to non-profit, non-commercial purposes. The source is provided
- * "as-is", without warranty.
- */
-
- // Modified by Richard Buckle 1994 for use with MetroWerks CodeWarrior.
- // All functions except bzero() removed, as I don't use them and couldn't
- // be bothered to port them.
-
- // richardb@cocytus.demon.co.uk
-
- /* Clear a block of memory starting from "ptr" (a0) */
- /* with size "cnt" bytes (d0) */
- // rewritten by JRB not to use assembler
- void bzero(b_8 *ptr, short cnt)
- {
- short myCount;
-
- for( myCount=0; myCount<cnt; myCount++)
- {
- ptr[myCount] = 0;
- }
- }
-
- #if 0 // removed by JRB -- not needed for ppp.interface.c
- asm void bzero(b_8 *ptr, short cnt)
- {
- movea.l ptr,a0 //get pointer to area to zero
- move.w cnt,d0 //and its length in bytes
- bra.s @20
-
- @10 clr.b (a0)+ //clear a byte
- @20 dbra d0, @10
- }
-
- /* SetLAPPtr and GetLAPPtr store and return lap pointer */
-
- LapInfo *GetLAPPtr();
-
- asm void SetLAPPtr(LapInfo *lap)
- {
- lea.l @LapPtr,a0
- move.l lap,(a0)
- bra.s @1
-
- extern GetLAPPtr:
- move.l @LapPtr,d0
- rts
-
- @LapPtr dc.l 0 /* pointer to LAP variable storage */
- @1
- }
-
-
- /* Return the current value of A5, and set A5 to the passed value */
- asm long seta5(long v)
- {
- move.l a5,d0 // return current a5 value
- movea.l v,a5 // set a5 to new value
- }
-
- /* return the current value of A5 */
- asm long geta5(void)
- {
- move.l a5,d0 // return current a5
- }
-
- /* Return the current value of A4, and set A4 to the passed value */
- asm long seta4(long v)
- {
- move.l a4,d0 // return current a4 value
- movea.l v,a4 // set a4 to new value
- }
-
- /* just return the current value of A4 */
- asm long geta4(void)
- {
- move.l a4,d0 // return current a4
- }
-
- /* set interrupt level */
- asm short set_sr(short v)
- {
- move sr,d0 // return current sr value
- move v,sr // set sr to mask interrupts
- }
-
- /* get status register */
- asm short get_sr(void)
- {
- move sr,d0 // get sr value
- }
-
- #endif